﻿using System;
using System.Web;

namespace Krupa.Pro.Web.Utility.HttpModules
{
    public class RemoveExtraneousHeadersModule : IHttpModule
    {
        #region Implementation of IHttpModule

        public void Init(HttpApplication context)
        {
            context.PreSendRequestHeaders += OnPreSendRequestHeaders;
        }

        private static void OnPreSendRequestHeaders(object sender, EventArgs e)
        {
            var headers = HttpContext.Current.Response.Headers;
            headers.Remove("Server");
            headers.Remove("X-AspNet-Version");
            headers.Remove("X-AspNetMvc-Version");
        }

        public void Dispose()
        {
            
        }

        #endregion
    }
}